es One pot fabrication of fluorescein functionalized manganese dioxide for fluorescence “Turn OFF–ON” sensing of hydrogen peroxide in water and cosmetic samples By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17506-17514DOI: 10.1039/D0RA01980A, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Hassan Refat H. Ali, Ahmed I. Hassan, Yasser F. Hassan, Mohamed M. El-WekilThe fluorometric nanoprobe was fabricated via doping of fluorescein dye in MnO2 nanosheets (FLS/MnO2 NS) via facile co-precipitation method. It was used for analysis of H2O2 in different matrices through liberation of FLS after reduction of MnO2 NS.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Borohydride catalyzed redistribution reaction of hydrosilane and chlorosilane: a potential system for facile preparation of hydrochlorosilanes By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17404-17407DOI: 10.1039/D0RA03536J, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Yi Chen, Liqing Ai, Yongming Li, Caihong XuA borohydride catalyzed Si–H/Si–Cl redistribution system was established to prepare hydrochlorosilanes facilely and efficiently.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Synthesis and gas permeation properties of thermally rearranged poly(ether-benzoxazole)s with low rearrangement temperatures By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17461-17472DOI: 10.1039/D0RA00145G, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Yunhua Lu, Jianhua Zhang, Guoyong Xiao, Lin Li, Mengjie Hou, Junyi Hu, Tonghua WangA series of poly(ether-benzoxazole)(PEBO) for gas separation were prepared from 9,9-bis[4-(4-amino-3-hydroxylphenoxy)phenyl]fluorene based hydroxyl-containing poly(ether-imide)s (HPEIs) with low rearrangement temperatures.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es The influence of structural gradients in large pore organosilica materials on the capabilities for hosting cellular communities By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17327-17335DOI: 10.1039/D0RA00927J, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Hannah Bronner, Anna-Katharina Holzer, Alexander Finke, Marius Kunkel, Andreas Marx, Marcel Leist, Sebastian PolarzChemical and structural gradients in biofunctionalized organosilica–polymer nanocomposites control cell adhesion properties and open perspectives for artificial cellular community systems.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Development of novel N-(6-methanesulfonyl-benzothiazol-2-yl)-3-(4-substituted-piperazin-1-yl)-propionamides with cholinesterase inhibition, anti-β-amyloid aggregation, neuroprotection and cognition enhancing properties for the therapy of Alzheimer's d By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17602-17619DOI: 10.1039/D0RA00663G, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Chandra Bhushan Mishra, Shruti Shalini, Siddharth Gusain, Amresh Prakash, Jyoti Kumari, Shikha Kumari, Anita Kumari Yadav, Andrew M. Lynn, Manisha TiwariA novel series of benzothiazole–piperazine hybrids were rationally designed, synthesized, and evaluated as multifunctional ligands against Alzheimer's disease (AD).The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Enhanced thermal stability, hydrophobicity, UV radiation resistance, and antibacterial properties of wool fabric treated with p-aminobenzenesulphonic acid By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17515-17523DOI: 10.1039/D0RA02267E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Mohammad Mahbubul HassanThe treatment with para-aminobenzenesulphonic acid produced a multifunctional wool fabric with enhanced hydrophobicity, thermal stability, UV resistance, and antibacterial properties.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Polypyrrole modified magnetic reduced graphene oxide composites: synthesis, characterization and application for selective lead adsorption By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17524-17533DOI: 10.1039/D0RA01546F, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Zhanmeng Liu, Zhimin Gao, Lichun Xu, Fengping HuCompared to Fe3O4/rGO, the PPy-FG composites showed desirable adsorption capacity and selectivity for Pb(II) from water.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Selective modification of Ti6Al4V surfaces for biomedical applications By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17642-17652DOI: 10.1039/C9RA11000C, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Gabriela Melo Rodriguez, James Bowen, Mischa Zelzer, Artemis StamboulisThe surface of a medical implant is required to interact favourably with ions, biomolecules and cells in vivo, commonly resulting in the formation of the extracellular matrix.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Cobalt–carbon/silica nanocomposites prepared by pyrolysis of a cobalt 2,2'-bipyridine terephthalate complex for remediation of cationic dyes By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17660-17672DOI: 10.1039/D0RA02752A, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Nusaybah Alotaibi, Hassan H. Hammud, Ranjith Kumar Karnati, Syed Ghazanfar Hussain, Javed Mazher, Thirumurugan PrakasamA cobalt–carbon@silica nanocomposite was synthesized from a cobalt 2,2'-bipyridine terephthalate complex and its adsorption behavior towards crystal violet dye was tested using batch and column techniques.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Ultrathin δ-MnO2 nanoflakes with Na+ intercalation as a high-capacity cathode for aqueous zinc-ion batteries By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17702-17712DOI: 10.1039/D0RA02556A, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Haijun Peng, Huiqing Fan, Chenhui Yang, Yapeng Tian, Chao Wang, Jianan SuiSodium-ion intercalated δ-MnO2 nanoflakes are applied in an aqueous rechargeable zinc battery cathode with high energy density and excellent durable stability.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Dip-coating decoration of Ag2O nanoparticles on SnO2 nanowires for high-performance H2S gas sensors By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17713-17723DOI: 10.1039/D0RA02266G, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Tran Thi Ngoc Hoa, Nguyen Van Duy, Chu Manh Hung, Nguyen Van Hieu, Ho Huu Hau, Nguyen Duc HoaAg2O nanoparticles decorated on the surface of on-chip growth SnO2 nanowires by a dip-coating method possessed excellent sensing performance for H2S gas.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Correction: Synthesis of α,β-unsaturated esters of perfluoropolyalkylethers (PFPAEs) based on hexafluoropropylene oxide units for photopolymerization By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17416-17417DOI: 10.1039/D0RA90036B, Correction Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Céline Bonneaud, Mélanie Decostanzi, Julia Burgess, Giuseppe Trusiano, Trevor Burgess, Roberta Bongiovanni, Christine Joly-Duhamel, Chadron M. FriesenThe content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Effect of temperature and large guest molecules on the C–H symmetric stretching vibrational frequencies of methane in structure H and I clathrate hydrates By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17473-17478DOI: 10.1039/D0RA02748K, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Go Fuseya, Satoshi Takeya, Akihiro HachikuboTemperature effect on C–H symmetric stretching frequencies of CH4 in water cages of sI and sH clathrate hydrates were clarified.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es One-pot oxime ligation from peptides bearing thiazolidine and aminooxyacetyl groups By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17681-17685DOI: 10.1039/D0RA03235B, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Stéphane Duflocq, Jingjing Zhou, Florent Huguenot, Michel Vidal, Wang-Qing LiuPd(II), acidic hydrolysis and iodine lead to one-pot oxime ligation from peptides bearing thiazolidine and aminooxyacetyl groups.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Boosting performances of triboelectric nanogenerators by optimizing dielectric properties and thickness of electrification layer By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17752-17759DOI: 10.1039/D0RA02181D, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Xiaofang Kang, Chongxiang Pan, Yanghui Chen, Xiong PuEnhanced output performances of a triboelectric nanogenerator (TENG) are achieved by optimizing the high-dielectric-constant filler content in the electrification layer and decreasing its thickness.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Mechanochemical approach to synthesize citric acid-soluble fertilizer of dittmarite (NH4MgPO4·H2O) from talc/NH4H2PO4 mixture By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17686-17693DOI: 10.1039/D0RA00387E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Yonghao Tan, Lin Sha, Nengkui Yu, Zhengshuo Yang, Jun Qu, Zhigao XuDittmarite synthesis by a mechanochemical route for application as a citric acid-soluble fertilizer.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Europium oxide nanorod-reduced graphene oxide nanocomposites towards supercapacitors By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17543-17551DOI: 10.1039/C9RA11012G, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Parisa Aryanrad, Hamid Reza Naderi, Elmira Kohan, Mohammad Reza Ganjali, Masoud Baghernejad, Amin Shiralizadeh DezfuliFast charge/discharge cycles are necessary for supercapacitors applied in vehicles including, buses, cars and elevators.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Enhancing the performance of LARP-synthesized CsPbBr3 nanocrystal LEDs by employing a dual hole injection layer By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17653-17659DOI: 10.1039/D0RA02622K, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Dingyan Xu, Qun Wan, Siyao Wu, Yu Zhao, Xinglei Xu, Liang Li, Gufeng HeThe current and power efficiencies of CsPbBr3 NC LEDs are improved 1.5 and 1.8 times by employing a dual HAT-CN/MoO3 hole injection layer.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Elongated conductive structures in detonation soot of high explosives By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17620-17626DOI: 10.1039/D0RA01393E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Nataliya P. Satonkina, Alexander P. Ershov, Alexey O. Kashkarov, Ivan A. RubtsovMicrographs of transmission electron microscopy of saved detonation products of benzotrifuroxane at different scales.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es A novel series of phenolic temozolomide (TMZ) esters with 4 to 5-fold increased potency, compared to TMZ, against glioma cells irrespective of MGMT expression By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17561-17570DOI: 10.1039/D0RA02686G, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Leroy Shervington, Oliver Ingham, Amal ShervingtonThe standard of care treatment for patients diagnosed with glioblastoma multiforme (GBM) is temozolomide (TMZ).The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es A highly sensitive, selective and renewable carbon paste electrode based on a unique acyclic diamide ionophore for the potentiometric determination of lead ions in polluted water samples By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17552-17560DOI: 10.1039/D0RA01435D, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.M. A. Zayed, Walaa H. Mahmoud, Ashraf A. Abbas, Aya E. Ali, Gehad G. MohamedDue to the toxicity of lead(II) to all living organisms destroying the central nervous system and leading to circulatory system and brain disorders, the development of effective and selective lead(II) ionophores for its detection is very important.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Electrochemical reduction of CO2 to ethylene on Cu/CuxO-GO composites in aqueous solution By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17572-17581DOI: 10.1039/D0RA02754E, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Nusrat Rashid, Mohsin Ahmad Bhat, U. K. Goutam, Pravin Popinand IngoleHerein, we present fabrication of graphene oxide supported Cu/CuxO nano-electrodeposits which efficiently and selectively can electroreduce CO2 into ethylene with a faradaic efficiency of 34% and conversion rate of 194 mmol g−1 h−1 at −0.985 V vs. RHE.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Correction: Influence of co-cultures of Streptococcus thermophilus and probiotic lactobacilli on quality and antioxidant capacity parameters of lactose-free fermented dairy beverages containing Syzygium cumini (L.) Skeels pulp By feeds.rsc.org Published On :: RSC Adv., 2020, 10,16905-16905DOI: 10.1039/D0RA90046J, Correction Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Sabrina Laís Alves Garcia, Gabriel Monteiro da Silva, Juliana Maria Svendsen Medeiros, Anna Paula Rocha de Queiroga, Blenda Brito de Queiroz, Daniely Rayane Bezerra de Farias, Joyceana Oliveira Correia, Eliane Rolim Florentino, Flávia Carolina Alonso BuritiThe content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es A poly(allylamine hydrochloride)/poly(styrene sulfonate) microcapsule-coated cotton fabric for stimulus-responsive textiles By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17731-17738DOI: 10.1039/D0RA02474K, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Zhiqi Zhao, Qiujin Li, Jixian Gong, Zheng Li, Jianfei ZhangThis study reports a stimulus-responsive fabric incorporating a combination of microcapsules, containing polyelectrolytes poly(allylamine hydrochloride) (PAH) and poly(styrene sulfonate) sodium salt (PSS), formed via a layer-by-layer (LBL) approach.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Computational study on the polymerization reaction of D-aminopeptidase for the synthesis of D-peptides By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17582-17592DOI: 10.1039/D0RA01138J, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Joan Gimenez-Dejoz, Kousuke Tsuchiya, Ayaka Tateishi, Yoko Motoda, Takanori Kigawa, Yasuhisa Asano, Keiji NumataWe studied the molecular mechanism of D-aminopeptidase for the synthesis of polypeptides incorporating D-amino acids.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es A chitosan-based edible film with clove essential oil and nisin for improving the quality and shelf life of pork patties in cold storage By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17777-17786DOI: 10.1039/D0RA02986F, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Karthikeyan Venkatachalam, Somwang LekjingThis study assessed chitosan (CS)-based edible films with clove essential oil (CO) and nisin (NI) singly or in combination, for improving quality and shelf life of pork patties stored in cold conditions.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Effect of Zn doping on phase transition and electronic structures of Heusler-type Pd2Cr-based alloys: from normal to all-d-metal Heusler By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17829-17835DOI: 10.1039/D0RA02951C, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Xiaotian Wang, Mengxin Wu, Tie Yang, Rabah KhenataBy first-principles calculations, for Heusler alloys Pd2CrZ (Z = Al, Ga, In, Tl, Si, Sn, P, As, Sb, Bi, Se, Te, Zn), the effect of Zn doping on their phase transition and electronic structure has been studied in this work.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Enhanced methane gas storage in the form of hydrates: role of the confined water molecules in silica powders By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17795-17804DOI: 10.1039/D0RA01754J, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Pinnelli S. R. Prasad, Burla Sai Kiran, Kandadai SowjanyaRapid and efficient methane hydrate conversions by utilising the water molecules confined in intra- and inter-granular space of silica powders.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Synthesis, characterization and corrosion inhibition behavior of 2-aminofluorene bis-Schiff bases in circulating cooling water By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17816-17828DOI: 10.1039/D0RA01903H, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Wenchang Wei, Zheng Liu, Chuxin Liang, Guo-Cheng Han, Jiaxing Han, Shufen ZhangTwo new bis-Schiff bases, namely 2-bromoisophthalaldehyde-2-aminofluorene (M1) and glutaraldehyde 2-aminofluorene (M2) were synthesized and were characterized, the potentiodynamic polarization curve confirmed that they were anode type inhibitors.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Facile synthesis of a direct Z-scheme BiOCl–phosphotungstic acid heterojunction for the improved photodegradation of tetracycline By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17369-17376DOI: 10.1039/D0RA02396E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Haijuan Tong, Bingfang Shi, Shulin ZhaoA one-step hydrothermal approach for synthesizing BiOCl–phosphotungstic acid (BiOCl–HPW) heterojunctions is proposed. The prepared BiOCl–HPW heterojunction exhibited good stability and photocatalytic activity.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Correction: Narrowing band gap and enhanced visible-light absorption of metal-doped non-toxic CsSnCl3 metal halides for potential optoelectronic applications By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17869-17869DOI: 10.1039/D0RA90054K, Correction Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Jakiul Islam, A. K. M. Akther HossainThe content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Effect of new carbonyl cyanide aromatic hydrazones on biofilm inhibition against methicillin resistant Staphylococcus aureus By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17854-17861DOI: 10.1039/D0RA03124K, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Xueer Lu, Ziwen Zhang, Yingying Xu, Jun Lu, Wenjian Tang, Jing Zhang2e and 2j with strong p-NO2 and p-CF3 at phenyl ring had the lowest MICs against S. aureus and MRSA. 2e displayed unaided or synergistic efficacy against MRSA, especially combined with ofloxacin. EM revealed that 2e destroys biofilms and cell membranes.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Research on the controllable degradation of N-methylamido and dialkylamino substituted at the 5th position of the benzene ring in chlorsulfuron in acidic soil By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17870-17880DOI: 10.1039/D0RA00811G, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Fan-Fei Meng, Lei Wu, Yu-Cheng Gu, Sha Zhou, Yong-Hong Li, Ming-Gui Chen, Shaa Zhou, Yang-Yang Zhao, Yi Ma, Zheng-Ming LiThese results will provide valuable information to discover tailored SU with controllable degradation properties to meet the needs of individual crops.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Nitrogen-doped RuS2 nanoparticles containing in situ reduced Ru as an efficient electrocatalyst for hydrogen evolution By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17862-17868DOI: 10.1039/D0RA02530E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Yan Xu, Xiaoping Gao, Jingyan Zhang, Daqiang GaoThe reasonable design that N-doping and in situ reduced Ru metal enhances the performance of N-RuS2/Ru for HER.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Lithium metal deposition/dissolution under uniaxial pressure with high-rigidity layered polyethylene separator By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17805-17815DOI: 10.1039/D0RA02788J, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Shogo Kanamori, Mitsuhiro Matsumoto, Sou Taminato, Daisuke Mori, Yasuo Takeda, Hoe Jin Hah, Takashi Takeuchi, Nobuyuki ImanishiThe use of a high rigidity separator and application of an appropriate amount of pressure are effective approaches to control lithium metal growth and improve its cycle performance.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Selenium modulates cadmium-induced ultrastructural and metabolic changes in cucumber seedlings By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17892-17905DOI: 10.1039/D0RA02866E, Paper Open Access   This article is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported Licence.Hongyan Sun, Xiaoyun Wang, Huimin Li, Jiahui Bi, Jia Yu, Xianjun Liu, Huanxin Zhou, Zhijiang RongIntensive insight into the potential mechanisms of Se-induced Cd tolerance in cucumber seedlings is essential for further improvement of vegetable crop cultivation and breeding to obtain high yields and quality in Cd-contaminated soil.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Synthesis of heteroatom-containing pyrrolidine derivatives based on Ti(O-iPr)4 and EtMgBr-catalyzed carbocyclization of allylpropargyl amines with Et2Zn By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17881-17891DOI: 10.1039/D0RA02677H, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Rita N. Kadikova, Ilfir R. Ramazanov, Azat M. Gabdullin, Oleg S. Mozgovoj, Usein M. DzhemilevThe Ti(O-iPr)4 and EtMgBr-catalyzed regio and stereoselective carbocyclization of N-allyl-substituted 2-alkynylamines with Et2Zn, followed by deuterolysis or hydrolysis, affords the corresponding methylenepyrrolidine derivatives in high yields.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Nanoporous materials with predicted zeolite topologies By feeds.rsc.org Published On :: RSC Adv., 2020, 10,17760-17767DOI: 10.1039/D0RA01888K, Paper Open Access   This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.Vladislav A. Blatov, Olga A. Blatova, Frits Daeyaert, Michael W. DeemTopological exploration of crystal structures demonstrates the presence of known zeolites, inorganics, and MOFs in a database of predicted materials.The content of this RSS Feed (c) The Royal Society of Chemistry Full Article
es Anatomy of an HTML5 WordPress theme By nicolasgallagher.com Published On :: Fri, 14 Aug 2009 17:00:00 -0700 This site has been written in HTML5 and used to use WordPress to manage the content. I’ll explain why I used HTML5, describe the structure of the theme templates, and show some of the ways I tried to tame WordPress’s tendency to add mess to the source code. As this is my personal site I wanted to experiment with using HTML5, CSS3, and WAI-ARIA. All these documents are currently working drafts and subject to change. However, the web documents and applications of the future are going to be written in HTML5 and I wanted to see the benefits of using it to markup static documents. Using CSS 2.1, let alone the CSS3 selectors and properties that some browser vendors have implemented, has many advantages for controlling the presentation of semantically coded documents. For this reason I am not going to avoid using basic CSS 2.1 selectors just to faithfully reproducing this site’s design in IE6. However, I have tried to accommodate IE 7 and IE 8 users by using an HTML5 enabling script so that the new HTML5 elements can be styled in those browsers if users have Javascript enabled. HTML5 templates I started with a static prototype of this site developed on my local server. WordPress makes it very easy to create your own templates and, therefore, it is no problem to use HTML5. This theme only has 3 main templates: index, single, and archive. There are of course templates for 404s, attachments, comments, etc., but I won’t discuss them as they are all based on the 3 main templates. All the templates include ARIA roles as an accessibility aide. The single.php template has this rough structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="default.css"> </head> <body> <header role="banner"></header> <nav role="navigation"></nav> <article role="main"> <header> <time datetime="YYYY-MM-DD"></time> <h1></h1> </header> <footer></footer> </article> <nav></nav> <aside role="complementary"></aside> <footer role="contentinfo"> <small></small> </footer> </body> </html> The first line of the document is the HTML5 DOCTYPE. The new <article> element contains the content of each post. The same structure is used for the index.php template except that there are several articles displayed on each page and the ARIA role value of main is not used. In contrast, the archive.php template houses all the article excerpts in a <section> element with the ARIA role of main because the list of archived posts is itself the main content of the document. A clean theme WordPress tends to add classes, elements, and other bits of code in certain places. I haven’t used any of the WordPress functions that add class names to the body and to elements wrapping a post and also wanted to avoid cluttering the source code with any other unnecessary markup. This required a bit of fiddling around with the theme’s functions.php file. I’m not a PHP developer so this might not be pretty! Removing actions from wp_head() WordPress has a hook called wp_head that sits in the header.php of most themes. To avoid it inserting unwanted code into the <head> of the document I used the remove_action function to disable the functions that were responsible. The following code was added to the functions.php file of my theme: // Remove links to the extra feeds (e.g. category feeds) remove_action( 'wp_head', 'feed_links_extra', 3 ); // Remove links to the general feeds (e.g. posts and comments) remove_action( 'wp_head', 'feed_links', 2 ); // Remove link to the RSD service endpoint, EditURI link remove_action( 'wp_head', 'rsd_link' ); // Remove link to the Windows Live Writer manifest file remove_action( 'wp_head', 'wlwmanifest_link' ); // Remove index link remove_action( 'wp_head', 'index_rel_link' ); // Remove prev link remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // Remove start link remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // Display relational links for adjacent posts remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Remove XHTML generator showing WP version remove_action( 'wp_head', 'wp_generator' ); Source: WPEngineer.com: Cleanup WordPress Header Removing an empty <span> If you want to create excerpts you can either write them into the excerpt box or use the <--more--> quicktag in the WordPress editor. I just wanted the first paragraph of my posts to be used as the excerpt and so using the in-editor tag was the most practical approach I was aware of. However, when you do this WordPress will insert an empty <span> in the post’s content. This element has an id so that the area following the excerpt can be targeted by “more” or “continue reading” links. I removed both the empty <span> and the jump link by adding the following code to the functions.php file of the theme: // removes empty span function remove_empty_read_more_span($content) { return eregi_replace("(<p><span id="more-[0-9]{1,}"></span></p>)", "", $content); } add_filter('the_content', 'remove_empty_read_more_span'); Source: Ganda Manurung: Remove Empty Span Tag On WordPress // removes url hash to avoid the jump link function remove_more_jump_link($link) { $offset = strpos($link, '#more-'); if ($offset) { $end = strpos($link, '"',$offset); } if ($end) { $link = substr_replace($link, '', $offset, $end-$offset); } return $link; } add_filter('the_content_more_link', 'remove_more_jump_link'); Source: WordPress Codex: Customizing the Read More Displaying images in the excerpt For posts that display nothing but a photograph (yes, they will be shit but I’m hoping it gets me using my camera a bit more often) I wanted the image to show up in the archives. Equally, if the first paragraph of a post contained a link I wanted that to be preserved. The default the_excerpt() template tag doesn’t allow for this so it needed some modifying. I added a new function, which is just a modified version of the core excerpt function, to the functions.php file and then made sure that the template tag executed this function rather than the one contained in the core WordPress files. function improved_trim_excerpt($text) { if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]&gt;', $text); $text = strip_tags($text, '<p><img><a>'); $excerpt_length = apply_filters('excerpt_length', 55); $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); $text = force_balance_tags($text); } } return $text; } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'improved_trim_excerpt'); Source: Aaron Russell: Improving WordPress’ the_excerpt() template tag Conditional next/prev links I prefer not to have empty elements in the markup and so I needed a way to conditionally insert the “Older entries”, “Newer Entries”, etc., links into templates. The solution I’m using here, which isn’t perfect, is to add this to functions.php: function show_posts_nav() { global $wp_query; return ($wp_query->max_num_pages > 1); } Source: Eric Martin: Conditional navigation links in WordPress And then to wrap the navigation markup in the templates with the following: <?php if (show_posts_nav()) : ?> <nav> <ul> <li><?php next_posts_link('« Older Entries') ?></li> <li><?php previous_posts_link('Newer Entries »') ?></li> </ul> </nav> <?php endif; ?> Summary It’s fairly easy to create a simple site with HTML5 and to use WordPress to deliver it. At the moment there are issues with Internet Explorer because you cannot style HTML5 elements unless you use Javascript. However, HTML5 redefines the meaning of certain elements (such as <dl>, which has become a more versatile “description list”) and allows block elements to be wrapped in a link. Therefore, there is still benefit in using the HTML5 DOCTYPE even if you do not make use of the new elements. Further reading HTML5 working draft HTML5 differences from HTML4 Accessible Rich Internet Applications (WAI-ARIA) 1.0 Full Article
es Wasp nest By nicolasgallagher.com Published On :: Thu, 26 Nov 2009 16:00:00 -0800 Most people I know hate and fear wasps. I’ve always been intrigued by them; they are quite beautiful looking insects – social insects – that have an important role in ecosystems. Their nests are incredible and I found and photographed a large nest constructed this year in our roof cavity. This nest is about the diameter of a football (soccer ball) and gives you an idea of the intricate structure of a wasp nest made up of thousands of thin fans of paper-like material. Unlike honey bees, wasps do not have wax-producing glands and those that make these kinds of nests construct them from a substance derived from wood pulp. They usually chew on dead or weathered wood and you can sometimes find wasps stripping thin layers from man-made wooden objects like park benches, panelling on houses, or exposed window frames. Wasps mix this wood with saliva to produce a paper-like material that is used to construct their nest. You can see how each fanned layer of paper is made up of bands of different colour. This is presumably because the layers been progressively built up by wasps returning with wood pulp sourced from different types and colours of wood. The final effect is really beautiful and it’s impressive to think that this kind of large organised structure, which houses the queen’s larvae in combs and regulates temperature, is the result of thousands of individual wasps working together. It is only used for one season before being abandoned as the winter approaches and the majority of the colony dies from cold. Full Article
es Using HTML5 elements in WordPress post content By nicolasgallagher.com Published On :: Wed, 24 Feb 2010 16:00:00 -0800 Here are two ways to include HTML5 elements in your WordPress post content without WordPress’ wpautop function wrapping them in p tags or littering your code with line breaks. HTML5 has several new elements that you may want to use in your post content to markup document sections, headers, footers, pullquotes, figures, or groups of headings. One way to safely include these elements in your posts is simple; the other way is a bit more complicated. Both ways rely on hand-coding the HTML5 markup in the WordPress editor’s HTML view. If you are adding HTML5 elements to your post content then you should use an HTML5 doctype. Disable wpautop for your theme This is the simple way. Disable the wpautop function so that WordPress makes no attempt to correct your markup and leaves you to hand-code every line of your posts. If you want total control over every line of your HTML then this is the option for you. To disable wpautop entirely add these lines to your theme’s functions.php: remove_filter('the_excerpt', 'wpautop'); remove_filter('the_content', 'wpautop'); However, wpautop is generally quite useful if most of your posts are simple text content and you only occasionally want to include HTML5 elements. Therefore, modifying wpautop to recognise HTML5 elements might be more practical. Modify wpautop to recognise HTML5 elements WordPress’ wpautop is part of the core functions and can be found in this file within your WordPress installation: wp-includes/formatting.php. It controls how and where paragraphs and line breaks are inserted in excerpts and post content. In order to create a modified version of WordPress’ core wpautop function I started off by duplicating it in my theme’s functions.php file. What I’ve experimented with is disabling wpautop and adding a modified copy of it – which includes HTML5 elements in its arrayss – to my theme’s functions.php file. Add the following to your theme’s functions.php file and you’ll be able to use section, article, aside, header, footer, hgroup, figure, details, figcaption, and summary in your post content. (Probably best to try this in a testing environment first!) /* ----------------------------- MODIFIED WPAUTOP - Allow HTML5 block elements in wordpress posts ----------------------------- */ function html5autop($pee, $br = 1) { if ( trim($pee) === '' ) return ''; $pee = $pee . " "; // just to make things a little easier, pad the end $pee = preg_replace('|<br />s*<br />|', " ", $pee); // Space things out a little // *insertion* of section|article|aside|header|footer|hgroup|figure|details|figcaption|summary $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|header|footer|hgroup|figure|details|figcaption|summary)'; $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', " $1", $pee); $pee = preg_replace('!(</' . $allblocks . '>)!', "$1 ", $pee); $pee = str_replace(array(" ", " "), " ", $pee); // cross-platform newlines if ( strpos($pee, '<object') !== false ) { $pee = preg_replace('|s*<param([^>]*)>s*|', "<param$1>", $pee); // no pee inside object/embed $pee = preg_replace('|s*</embed>s*|', '</embed>', $pee); } $pee = preg_replace("/ +/", " ", $pee); // take care of duplicates // make paragraphs, including one at the end $pees = preg_split('/ s* /', $pee, -1, PREG_SPLIT_NO_EMPTY); $pee = ''; foreach ( $pees as $tinkle ) $pee .= '<p>' . trim($tinkle, " ") . "</p> "; $pee = preg_replace('|<p>s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace // *insertion* of section|article|aside $pee = preg_replace('!<p>([^<]+)</(div|address|form|section|article|aside)>!', "<p>$1</p></$2>", $pee); $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); // don't pee all over a tag $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee); $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); if ($br) { $pee = preg_replace_callback('/<(script|style).*?</\1>/s', create_function('$matches', 'return str_replace(" ", "<WPPreserveNewline />", $matches[0]);'), $pee); $pee = preg_replace('|(?<!<br />)s* |', "<br /> ", $pee); // optionally make line breaks $pee = str_replace('<WPPreserveNewline />', " ", $pee); } $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*<br />!', "$1", $pee); // *insertion* of img|figcaption|summary $pee = preg_replace('!<br />(s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol|img|figcaption|summary)[^>]*>)!', '$1', $pee); if (strpos($pee, '<pre') !== false) $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee ); $pee = preg_replace( "| </p>$|", '</p>', $pee ); return $pee; } // remove the original wpautop function remove_filter('the_excerpt', 'wpautop'); remove_filter('the_content', 'wpautop'); // add our new html5autop function add_filter('the_excerpt', 'html5autop'); add_filter('the_content', 'html5autop'); The results are not absolutely perfect but then neither is the original wpautop function. Certain ways of formatting the code will result in unwanted trailing </p> tags or a missing opening <p> tags. For example, to insert a figure with caption into a post you should avoid adding the figcaption on a new line because an image or link appearing before the figcaption will end up with a trailing </p>. <!-- this turns out ok --> <figure> <a href="#"><img src="image.jpg" alt="" /></a><figcaption>A figure caption for your reading pleasure</figcaption> </figure> <!-- this turns out not so ok --> <figure> <a href="#"><img src="image.jpg" alt="" /></a> <figcaption>A figure caption for your reading pleasure</figcaption> </figure> Another example would be when beginning the contents of an aside with a paragraph. You’ll have to leave a blank line between the opening aside tag and the first paragraph. <aside> This content could be a pullquote or information that is tangentially related to the surrounding content. But to get it wrapped in a paragraph you have to leave those blank lines either side of it before the tags. </aside> Room for improvement Obviously there are still a few issues with this because if you format your post content in certain ways then you can end up with invalid HTML, even if it doesn’t actually affect the rendering of the page. But it seems to be pretty close! Leave a comment or email me if you are using this function and find there that are instances where it breaks down. I ran numerous tests and formatting variations to try and iron out as many problems as possible but it’s unlikely that I tried or spotted everything. Hopefully someone with more PHP and WordPress experience will be able to improve upon what I’ve been experimenting with, or find a simpler and more elegant solution that retains the useful wpautop functionality while allowing for the use of HTML5 elements in posts. Please share anything you find! Full Article
es Pure CSS speech bubbles By nicolasgallagher.com Published On :: Thu, 04 Mar 2010 16:00:00 -0800 Speech bubbles are a popular effect but many tutorials rely on presentational HTML or JavaScript. This tutorial contains various forms of speech bubble effect created with CSS 2.1 and enhanced with CSS3. No images, no JavaScript and it can be applied to your existing semantic HTML. The CSS file used in the demo page is heavily commented so that you can see which lines of code are responsible for each part of the effects. Demo: Pure CSS speech bubbles Support: Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10+, IE8+. Progressive enhancement with pseudo-elements With HTML as simple as <div>Content</div> or <p>Content</p> you can produce speech bubble effects like this: Add a child element, for example, <blockquote><p>Quote</p></blockquote> and you can even produce speech bubble effects like this: I’d encourage you to adapt the examples to your needs and use any other associated elements available to you in your existing HTML document. The key is to use the :before and/or :after pseudo-elements to produce basic shapes. By applying CSS3 properties such as border-radius and transform you can produce more complex shapes and orientations. This is how the heart-shape in my CSS typography experiment was created. Example code This is an example of how to create a basic speech bubble with a few enhancements. For further examples see the demo page and the heavily commented CSS file that it uses. /* Bubble with an isoceles triangle ------------------------------------------ */ .triangle-isosceles { position: relative; padding: 15px; margin: 1em 0 3em; color: #000; background: #f3961c; border-radius: 10px; background: linear-gradient(top, #f9d835, #f3961c); } /* creates triangle */ .triangle-isosceles:after { content: ""; display: block; /* reduce the damage in FF3.0 */ position: absolute; bottom: -15px; left: 50px; width: 0; border-width: 15px 15px 0; border-style: solid; border-color: #f3961c transparent; } A note on progressive enhancement This approach is one of progressive enhancement. Styles are built up in layers from simple coloured boxes, to boxes with a “speech tick” of some kind, to rounded rectangles or circles with gradient backgrounds. Browsers render the styles that they are capable of rendering. Browsers (such as IE6 and IE7) that do not adequately support CSS 2.1 or those (such as IE8) without support for the necessary CSS3 properties will not look broken; they will simply not get the full speech bubble effect. However… A warning about Firefox 3.0 Firefox 3.0 supports the necessary CSS 2.1 pseudo-elements but does not support the positioning of generated content. Some of the examples are close to what I consider to be unacceptably broken in Firefox 3.0. It is the only browser above 2% market share — currently at ~4% as of March 2010 according to NetApplications — that cannot handle even the basic speech bubble effects. Before applying this technique, consider the importance of Firefox 3.0 support and the percentage of your visitors currently using this browser. Eventually it will become a rare browser but due to it’s partial CSS 2.1 support you should be aware that there is no graceful fallback for Firefox 3.0 when using this technique. Full Article
es Animal virtues & choice fetishism By nicolasgallagher.com Published On :: Tue, 17 Aug 2010 17:00:00 -0700 The following is an interesting extract from Straw Dogs by John Gray (pp. 109–116) discussing some of the differences between Western and Taoist philosophical traditions. The fetish of choice For us, nothing is more important than to live as we choose. This is not because we value freedom more than people did in earlier times. It is because we have identified the good life with the chosen life. For the pre-Socratic Greeks, the fact that our lives are framed by limits was what makes us human. Being born a mortal, in a given place and time, strong or weak, swift or slow, brave or cowardly, beautiful or ugly, suffering tragedy or being spared it – these features of our lives are given to us, they cannot be chosen. If the Greeks could have imagined a life without them, they could not have recognised it as that of a human being. The ancient Greeks were right. The ideal of the chosen life does not square with how we live. We are not authors of our lives; we are not even part-authors of the events that mark us most deeply. Nearly everything that is most important in our lives is unchosen. The time and place we are born, our parents, the first language we speak – these are chance, not choice. It is the casual drift of things that shapes our most fateful relationships. The life of each of us is a chapter of accidents. Personal autonomy is the work of our imagination, not the way we live. Yet we have been thrown into a time in which everything is provisional. New technologies alter our lives daily. The traditions of the past cannot be retrieved. At the same time we have little idea of what the future will bring. We are forced to live as if we were free. The cult of choice reflects the fact that we must improvise our lives. That we cannot do otherwise is a mark of our unfreedom. Choice has become a fetish; but the mark of a fetish is that it is unchosen. Animal virtues The dominant Western view…teaches that humans are unlike other animals, which simply respond to the situations in which they find themselves. We can scrutinise our motives and impulses; we can know why we act as we do. By becoming ever more self-aware, we can approach a point at which our actions are the results of our choices. When we are fully conscious, everything we do will be done for reasons we can know. At that point, we will be authors of our lives. This may seem fantastical, and so it is. Yet it is what we are taught by Socrates, Aristotle and Plato, Descartes, Spinoza and Marx. For all of them, consciousness is our very essence, and the good life means living as a fully conscious individual. … Western thought is fixated on the gap between what is and what ought to be. But in everyday life we do not scan our options beforehand, then enact the one that is best. We simply deal with whatever is at hand. …Different people follow different customs; but in acting without intention, we are not simply following habit. Intentionless acts occur in all sorts of situations, including those we have never come across before. Outside the Western tradition, the Taoists of ancient China saw no gap between is and ought. Right action was whatever comes from a clear view of the situation. They did not follow moralists – in their day, Confucians – in wanting to fetter human beings with rules or principles. For Taoists, the good life is only the natural life lived skillfully. It has no particular purpose. It has nothing to do with the will, and it does not consist in trying to realise any ideal. Everything we do can be done more or less well; but if we act well it is not because we translate our intentions into deeds. It is because we deal skillfully with whatever needs to be done. The good life means living according to our natures and circumstances. There is nothing that says that it is bound to be the same for everybody, or that it must conform with ‘morality’. In Taoist thought, the good life comes spontaneously; but spontaneity is far from simply acting on the impulses that occur to us. In Western traditions such as Romanticism, spontaneity is linked with subjectively. In Taoism it means acting dispassionately, on the basis of an objective view of the situation at hand. The common man cannot see things objectively, because his mind is clouded by anxiety about achieving his goals. Seeing clearly means not projecting our goals into the world; acting spontaneously means acting according to the needs of the situation. Western moralists will ask what is the purpose of such action, but for Taoists the good life has no purpose. It is like swimming in a whirlpool, responding to the currents as they come and go. ‘I enter with the inflow, and emerge with the outflow, follow the Way of the water, and do not impose my selfishness upon it. This is how I stay afloat in it,’ says the Chuang-Tzu. In this view, ethics is simply a practical skill, like fishing or swimming. The core of ethics is not choice or conscious awareness, but the knack of knowing what to do. It is a skill that comes with practice and an empty mind. A.C. Graham explains: The Taoist relaxes the body, calms the mind, loosens the grip of categories made habitual by naming, frees the current of thought for more fluid differentiations and assimilations, and instead of pondering choices lets the problems solve themselves as inclination spontaneously finds its own direction. …He does not have to make decisions based on standards of good and bad because, granted only that enlightenment is better than ignorance, it is self-evident that among spontaneous inclinations the one prevailing in the greatest clarity of mind, other things being equal, will be best, the one in accord with the Way. Few humans beings have the knack of living well. Observing this, the Taoists looked to other animals as their guides to the good life. Animals in the wild know how to live, they do not need to think or choose. It is only when they are fettered by humans that they cease to live naturally. As the Chuang-Tzu puts it, horses, when they live wild, eat grass and drink water; when they are content, they entwine their necks and rub each other. When angry, they turn their backs on each other and kick out. This is what horses know. But if harnessed together and lined up under constraints, they know how to look sideways and to arch their necks, to career around and try to spit out the bit and rid themselves of the reins. For people in thrall to ‘morality’ , the good life means perpetual striving. For Taoists it means living effortlessly, according to our natures. The freest human being is not the one who acts on reasons he has chosen for himself, but one who never has to choose. Rather than agonising over alternatives, he responds effortlessly to situations as they arise. He lives not as he chooses but as he must. Such a human has the perfect freedom of a wild animal – or a machine. As the Lieh-Tzu says: ‘The highest man at rest is as though dead, in movement is like a machine. He knows neither why he is at rest nor why he is not, why he is in movement nor why he is not.’ The idea that freedom means becoming like a wild animal or machine is offensive to Western religious and humanist prejudices, but it is consistent with the most advanced scientific knowledge. A.C. Graham explains: Taoism coincides with the scientific worldview at just those points where the latter most disturbs westerners rooted in the Christian tradition – the littleness of man in a vast universe; the inhuman Tao which all things follow, without purpose and indifferent to human needs; the transience of life, the impossibility of knowing what comes after death; unending change in which the possibility of progress is not even conceived; the relativity of values; a fatalism very close to determinism; even a suggestion that the human organism operates like a machine. Autonomy means acting on reasons I have chosen; but the lesson of cognitive science is that there is no self to do the choosing. We are far more like machines and wild animals than we imagine. But we cannot attain the amoral selflessness of wild animals, or the choiceless automatism of machines. Perhaps we can learn to live more lightly, less burdened by morality. We cannot return to a purely spontaneous existence. Full Article
es Custom Tweet Button for WordPress By nicolasgallagher.com Published On :: Thu, 16 Sep 2010 17:00:00 -0700 How to create a custom Tweet Button for WordPress using the bit.ly and Twitter APIs. The HTML and CSS is completely customisable and there is no need for JavaScript. PHP is used to automatically shorten and cache the URL of a post, fetch and cache the number of retweets, and populate the query string parameters in the link to Twitter. The custom Tweet Button at the bottom of this post was created using this method. All the files are available on Github and released under MIT license. The PHP code was heavily influenced by the BackType Tweetcount plugin. How to use You’ll need your own bit.ly account and to be comfortable editing your theme’s functions.php, style.css, and template files. Be sure to make backups before you start making changes. Step 1: Download the Custom Tweet Button for WordPress files from Github. Step 2: Include the custom-tweet-button.php file in your theme’s functions.php file. Step 3: Replace the bit.ly username, bit.ly API key, and Twitter username placeholders in the tweet_button function with your own. Your bit.ly credentials can be found on the “settings” page of your account. Step 4: Add the custom Tweet Button CSS to your theme’s style.css file. Add the tweet.png image in your theme’s image folder. Make sure the image is correctly referenced in the CSS file. Step 5: Call the function tweet_button in your template files (e.g. single.php) at the position(s) in the HTML you’d like the Tweet Button to appear: if (function_exists('tweet_button')) { tweet_button(get_permalink()); } Why make your own Tweet Button? Making your own custom Tweet Button for WordPress has several additional advantages over using Twitter’s own offerings. Full control over the HTML and CSS. Having full control over the HTML and CSS means that you can choose how to present your Tweet Button. I decided to reproduce the horizontal and vertical styles of Twitter’s own button. But any appearance is possible. All click, traffic, and referrer data is stored in your bit.ly account. The URL for any published post is automatically shortened using the bit.ly service. The short URL is then passed to Twitter to ensure you can monitor the click and traffic data in your bit.ly account. The permalink is passed to Twitter in the counturl query string parameter to ensure that it counts the URL that your short URL resolves to. No need for JavaScript or embedded iframes. The Tweet Button works without JavaScript. You have full control over any custom JavaScript enhancements you may wish to include. If you’d prefer Twitter’s share page to open in a pop-up window you can write your own JavaScript handler. Faster page load. No external JavaScript or image files are loaded; both the short URL and retweet counts are cached. Use the short URL and retweet count for other purposes. The short URLs and retweet counts are stored as post meta-data. This makes it easy to display this data anywhere else in a post. The retweet count data could be used for conditional template logic. For example, you could order posts based on the number of retweets, apply custom styles to your most retweeted posts, or display your most tweeted posts in a widget. Easy to add Google Analytics campaign and event tracking. The Tweet Button is simple HTML and you have control over all the information that is sent to Twitter. Therefore, it is possible to use Google Analytics to help answer questions like: are people sharing your posts from the homepage or the post itself? If the Tweet Button is displayed above and below your posts, which gets the most clicks? How long do people take to click the Tweet Button? How many people are visiting my site thanks to links posted on Twitter using the Tweet Button? Approximate the number of retweets for old posts. Before the release of the official Tweet Button, Twitter did not collect data on the number of times a URL was tweeted. This means your older posts may display far fewer retweets than actually occurred. However, there is a workaround. Use a service like Topsy, Backtype, or Tweetmeme to get the number of times your old post was retweeted. The difference between this and the number from Twitter’s APIs is the approximate number of retweets Twitter missed. To correct the retweet count for old posts add the number of missed retweets to a Custom Field called retweet_count_start. How the custom Tweet Button works Once a post is published its permalink URL is shortened using the bit.ly API. The returned URL is permanently cached in the bitly_short_url Custom Field. The short URL is now part of the post’s general meta-data and can be used in contexts other than the Tweet Button. The Twitter API is used to get the number of retweets for the post’s permalink URL. This number, along with the time at which it was requested, is cached in the retweet_cache Custom Field. When the cache interval has passed, an API call is made and the returned number of retweets is checked against the value stored in retweet_cache. If the returned number is greater, the value of retweet_cache is updated. The content of the tweet is automatically created by setting several properties for the http://twitter.com/share URL. The post title makes up the message; the short URL is passed to Twitter as the URL to be displayed in the tweet; the permalink URL is passed to Twitter as the URL to be counted; and your username is declared. $twitter_params = '?text=' . urlencode($title) . '&url=' . urlencode($short_url) . '&counturl=' .urlencode($url). '&via=' . $twitter_via; The default HTML output is very simple and can be fully customised. To display the count number vertically, add the class vcount. <div class="twitter-share vcount> <a class="twitter-button" rel="external nofollow" title="Share this on Twitter" href="http://twitter.com/share?query-string-params" target="_blank">Tweet</a> <a class="twitter-count" href="http://twitter.com/search?q=url>259</a> </div> Further enhancements Please apply any improvements or enhancements for the script against the source repository. Full Article
es CSS drop-shadows without images By nicolasgallagher.com Published On :: Fri, 10 Dec 2010 16:00:00 -0800 Drop-shadows are easy enough to create using pseudo-elements. It’s a nice and robust way to progressively enhance a design. This post is a summary of the technique and some of the possible appearances. Demo: CSS drop-shadows without images Known support: Firefox 3.5+, Chrome 5+, Safari 5+, Opera 10.6+, IE 9+ I’ll be looking mainly at a few details involved in making this effect more robust. Divya Manian covered the basic principle in her article Drop Shadows with CSS3 and Matt Hamm recently shared his Pure CSS3 box-shadow page curl effect. After a bit of back-and-forth on Twitter with Simurai, and proposing a couple of additions to Divya’s and Matt’s demos using jsbin, I felt like documenting and explaining the parts that make up this technique. The basic technique There is no need for extra markup, the effect can be applied to a single element. A couple of pseudo-elements are generated from an element and then pushed behind it. .drop-shadow { position: relative; width: 90%; } .drop-shadow:before, .drop-shadow:after { content: ""; position: absolute; z-index: -1; } The pseudo-elements need to be positioned and given explicit or implicit dimensions. .drop-shadow:before, .drop-shadow:after { content: ""; position: absolute; z-index: -1; bottom: 15px; left: 10px; width: 50%; height: 20%; } The next step is to add a CSS3 box-shadow and apply CSS3 transforms. Different types of drop-shadow can be produced by varying these values and the types of transforms applied. .drop-shadow:before, .drop-shadow:after { content: ""; position: absolute; z-index: -1; bottom: 15px; left: 10px; width: 50%; height: 20%; box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7); transform: rotate(-3deg); } One of the pseudo-elements then needs to be positioned on the other side of the element and rotated in the opposite direction. This is easily done by overriding only the properties that need to differ. .drop-shadow:after{ right: 10px; left: auto; transform: rotate(3deg); } The final core code is as shown below. There is just one more addition – max-width – to prevent the drop-shadow from extending too far below very wide elements. .drop-shadow { position: relative; width: 90%; } .drop-shadow:before, .drop-shadow:after { content: ""; position: absolute; z-index: -1; bottom: 15px; left: 10px; width: 50%; height: 20%; max-width: 300px; box-shadow :0 15px 10px rgba(0, 0, 0, 0.7); transform: rotate(-3deg); } .drop-shadow:after{ right: 10px; left: auto; transform: rotate(3deg); } No Firefox 3.0 problems this time Some pseudo-element hacks require a work-around to avoid looking broken in Firefox 3.0 because that browser does not support the positioning of pseudo-elements. This usually involves implicitly setting their dimensions using offsets. However, as Divya Manian pointed out to me, in this case we’re only using box-shadow – which Firefox 3.0 doesn’t support – and Firefox 3.0 will ignore the position:absolute declaration for the pseudo-elements. This leaves them with the default display:inline style. As a result, there is no problem explicitly setting the pseudo-element width and height because it won’t be applied to the pseudo-elements in Firefox 3.0. Further enhancements From this base there are plenty of ways to tweak the effect by applying skew to the pseudo-elements and modifying the styles of the element itself. A great example of this was shared by Simurai. By adding a border-radius to the element you can give the appearance of page curl. .drop-shadow { border-radius: 0 0 120px 120px / 0 0 6px 6px; } I’ve put together a little demo page with a few of drop-shadow effects, including those that build on the work of Divya Manian and Matt Hamm. If you’ve got your own improvements, please send them to me on Twitter. Full Article
es Better float containment in IE using CSS expressions By nicolasgallagher.com Published On :: Mon, 25 Apr 2011 17:00:00 -0700 Research into improving the cross-browser consistency of both the “clearfix” and “overflow:hidden” methods of containing floats. The aim is to work around several bugs in IE6 and IE7. This article introduces a new hack (with caveats) that can benefit the “clearfix” methods and the new block formatting context (NBFC) methods (e.g. using overflow:hidden) of containing floats. It’s one outcome of a collaboration between Nicolas Gallagher (that’s me) and Jonathan Neal. If you are not familiar with the history and underlying principles behind methods of containing floats, I recommend that you have a read of Easy clearing (2004), Everything you know about clearfix is wrong (2010), and Clearfix reloaded and overflow:hidden demystified (2010). Consistent float containment methods The code is show below and documented in this GitHub gist. Found an improvement or flaw? Please fork the gist or leave a comment. Micro clearfix hack: Firefox 3.5+, Safari 4+, Chrome, Opera 9+, IE 6+ .cf { /* for IE 6/7 */ *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif"); /* non-JS fallback */ *zoom: 1; } .cf:before, .cf:after { content: ""; display: table; } .cf:after { clear: both; } Overflow hack (NBFC): Firefox 2+, Safari 2+, Chrome, Opera 9+, IE 6+ .nbfc { overflow: hidden; /* for IE 6/7 */ *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif"); /* non-JS fallback */ *zoom: 1; } The GitHub gist also contains another variant of the clearfix method for modern browsers (based on Thierry Koblentz’s work). It provides greater visual consistency (avoiding edge-case bugs) for even older versions of Firefox. The only difference from existing float-containment methods is the inclusion of a CSS expression that inserts a clearing line-break in IE 6 and IE 7. Jonathan and I found that it helps to resolve some of the visual rendering differences that exist between these browsers and more modern ones. First I’ll explain what some of those differences are and when they occur. Containing floats in IE 6/7 In IE 6 and IE 7, the most common and robust method of containing floats within an element is to give it “layout” (find out more: On having Layout). Triggering “layout” on an element in IE 6/7 creates a new block formatting context (NBFC). However, certain IE bugs mean that previous float containment methods don’t result in cross-browser consistency. Specifically, this is what to expect in IE 6/7 when creating a NBFC: The top- and bottom-margins of non-floated child elements are contained within the ancestor element that has been given “layout”. (Also expected in other browsers when creating a NBFC) The bottom-margins of any right-floated descendants are contained within the ancestor. (Also expected in other browsers when creating a NBFC) The bottom-margins of any left-floated children are not contained within the ancestor. The margin has no effect on the height of the ancestor and is truncated, having no affect outside of the ancestor either. (IE 6/7 bug) In IE 6, if the right edge of the margin-box of a left-floated child is within 2px of the left edge of the content-box of its NBFC ancestor, the float’s bottom margin reappears and is contained within the parent. (IE 6 bug) Unwanted white-space can appear at the bottom of a float-container. (IE 6/7 bug) There is a lack of consistency between IE 6/7 and other browsers, and between IE 6 and IE 7. Thanks to Matthew Lein for his comment that directed me to this IE 6/7 behaviour. It was also recently mentioned by “Suzy” in a comment on Perishable Press. IE 6/7’s truncation of the bottom-margin of left-floats is not exposed in many of the test-cases used to demonstrate CSS float containment techniques. Using an IE-only CSS expression helps to correct this bug. The CSS expression Including the much maligned <br style="clear:both"> at the bottom of the float-container, as well as creating a NBFC, resolved all these inconsistencies in IE 6/7. Doing so prevents those browsers from collapsing (or truncating) top- and bottom-margins of descendant elements. Jonathan suggested inserting the clearing line-break in IE 6/7 only, using CSS expressions applied to fictional CSS properties. The CSS expression is the result of many iterations, tests, and suggestions. It runs only once, the first time an element receives the associated classname. *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif"); It is applied to zoom, which is already being used to help contain floats in IE 6/7, and the use of the runtimeStyle object ensures that the expression is replaced once it has been run. The addition of font:0/0 serif prevents the occasional appearance of white-space at the bottom of a float-container. And the * hack ensures that only IE 6 and IE 7 parse the rule. It’s worth noting that IE 6 and IE 7 parse almost any string used as CSS property. An earlier iteration used the entirely fictitious properties “-ms-inject” or “-ie-x” property to exploit this IE behaviour. *-ie-x: expression(this.x||(this.innerHTML+='<br style="clear:both;font:0/0">',this.x=1)); However, this expression is evaluated over and over again. Using runtimeStyle instead avoids this. Sergey Chikuyonok also pointed out that using innerHTML destroys existing HTML elements that may event handlers attached to them. By using document.createElement and appendChild you can insert the new element without removing all the events attached to other descendant elements. Containing floats in more modern browsers There are two popular methods to contain floats in modern browsers. Creating a new block formatting context (as is done in IE 6/7 when hasLayout is triggered) or using a variant of the “clearfix” hack. Creating a NBFC results in an element containing any floated children, and will prevent top- and bottom-margin collapse of non-floated children. When combined with the enhanced IE 6/7 containment method, it results in consistent cross-browser float containment. The other method, known as “clearfix”, traditionally used a single :after pseudo-element to clear floats in a similar fashion to a structural, clearing HTML line-break. However, to prevent the top-margins of non-floats from collapsing into the margins of their float-containing ancestor, you also need to use the :before pseudo-element. This is the approach taken in Thierry Koblentz’s “clearfix reloaded”. In contemporary browsers, the micro clearfix hack is also suitable. The method presented in this article should help improve the results of cross-browser float containment, whether you predominantly use “clearfix” or the NBFC method. The specific limitations of both the “clearfix” and various NBFC methods (as outlined in Thierry’s articles) remain. Problems Using a CSS expression to change the DOM in IE 6/7 creates problems of its own. Obviously, the DOM in IE 6/7 is now different to the DOM in other browsers. This affects any JavaScript DOM manipulation that may depend on :last-child or appending new children. This is still an experimental work-in-progress that is primarily research-driven rather than seeking to become a practical snippet of production code. Any feedback, further testing, and further experimentation from others would be much appreciated. Thanks to these people for contributing improvements: Jonathan Neal, Mathias Bynens, Sergey Chikuyonok, and Thierry Koblentz. Full Article
es Responsive images using CSS3 By nicolasgallagher.com Published On :: Wed, 18 May 2011 17:00:00 -0700 Future CSS implementations should allow for some form of responsive images via CSS alone. This is an early idea for how that might be done. However, a significant drawback is that it would not prevent both “mobile optimised” and larger size images from being requested at larger screen resolutions. Note that the CSS presented here is not supported in any browsers at the time of writing. This method relies on the use of @media queries, CSS3 generated content, and the CSS3 extension to the attr() function. The principles are basically the same as those underpinning Filament Group’s work on Responsive Images. The source image is “mobile optimised” and the urls of larger size images are included using HTML data-* attributes. <img src="image.jpg" data-src-600px="image-600px.jpg" data-src-800px="image-800px.jpg" alt=""> Using CSS @media queries you can target devices above certain widths. Within each media query block, images with larger alternatives can be targeted using an attribute selector. CSS3 generated content allows you to replace the content of any element using the content property. At the moment, only Opera 10+ supports it. In CSS 2.1, the content property is limited to use with the :before and :after pseudo-elements. By combining the content property with the CSS3 extension to attr(), you will be able to specify that an attribute’s value is interpreted as the URL part of a url() expression. In this case, it means you will be able to replace an image’s content with the image found at the destination URL stored in a custom HTML data-* attribute. @media (min-device-width:600px) { img[data-src-600px] { content: attr(data-src-600px, url); } } @media (min-device-width:800px) { img[data-src-800px] { content: attr(data-src-800px, url); } } Fork the Gist Issues Unfortunately, there are a number of issues with this technique. It doesn’t prevent multiple assets being downloaded at larger screen widths because network activity kicks in before CSS is applied. That means, for example, that desktop environments would make 2 HTTP requests for an image and have to load more assets than if they had been served only the larger image in the source. It makes the assumption that wider screens are tied to better internet connections. It forces authors to create and maintain multiple image sizes for each image. At present, using the context menu (or drag and drop) to copy the image will result in the source file being copied and not the replacement image. It doesn’t account for devices with different pixel densities. Full Article
es Better conditional classnames for hack-free CSS By nicolasgallagher.com Published On :: Thu, 19 May 2011 17:00:00 -0700 Applying conditional classnames to the html element is a popular way to help target specific versions of IE with CSS fixes. It was first described by Paul Irish and is a feature of the HTML5 Boilerplate. Despite all its benefits, there are still a couple of niggling issues. Here are some hacky variants that side-step those issues. An article by Paul Irish, Conditional stylesheets vs CSS hacks? Answer: Neither!, first proposed that conditional comments be used on the opening html tag to help target legacy versions of IE with CSS fixes. Since its inclusion in the HTML5 Boilerplate project, contributors have further refined the technique. However, there are still some niggling issues with the “classic” conditional comments approach, which Mathias Bynens summarized in a recent article on safe CSS hacks. The Compatibility View icon is displayed in IE8 and IE9 if you are not setting the X-UA-Compatible header in a server config. The character encoding declaration might not be fully contained within the first 1024 bytes of the HTML document if you need to include several attributes on each version of the opening html tag (e.g. Facebook xmlns junk). You can read more about the related discussions in issue #286 and issue #378 at the HTML5 Boilerplate GitHub repository. The “bubble up” conditional comments method Although not necessarily recommended, it looks like both of these issues can be avoided with a bit of trickery. You can create an uncommented opening html tag upon which any shared attributes (so no class attribute) can be set. The conditional classes are then assigned in a second html tag that appears after the <meta http-equiv="X-UA-Compatible"> tag in the document. The classes will “bubble up” to the uncommented tag. <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <!--[if lt IE 7]><html class="no-js ie6"><![endif]--> <!--[if IE 7]><html class="no-js ie7"><![endif]--> <!--[if IE 8]><html class="no-js ie8"><![endif]--> <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--> <title>Document</title> </head> <body> </body> </html> Fork the Gist The result is that IE8 and IE9 won’t ignore the <meta http-equiv="X-UA-Compatible"> tag, the Compatibility View icon will not be displayed, and the amount of repeated code is reduced. Obviously, including a second html tag in the head isn’t pretty or valid HTML. If you’re using a server-side config to set the X-UA-Compatible header (instead of the meta tag), then you can still benefit from the DRYer nature of using two opening html tags and it isn’t necessary to include the conditional comments in the head of the document. However, you might still want to do so if you risk not containing the character encoding declaration within the first 1024 bytes of the document. <!DOCTYPE html> <html lang="en"> <!--[if lt IE 7]><html class="no-js ie6"><![endif]--> <!--[if IE 7]><html class="no-js ie7"><![endif]--> <!--[if IE 8]><html class="no-js ie8"><![endif]--> <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--> <head> <meta charset="utf-8"> <title>Document</title> </head> <body> </body> </html> Fork the Gist The “preemptive” conditional comments method Another method to prevent the Compatibility View icon from showing was found by Julien Wajsberg. It relies on including a conditional comment before the DOCTYPE. Doing this seems to help IE recognise the <meta http-equiv="X-UA-Compatible"> tag. This method isn’t as DRY and doesn’t have the character encoding declaration as high up in the document, but it also doesn’t use 2 opening html elements. <!--[if IE]><![endif]--> <!DOCTYPE html> <!--[if lt IE 7]><html class="no-js ie6"><![endif]--> <!--[if IE 7]><html class="no-js ie7"><![endif]--> <!--[if IE 8]><html class="no-js ie8"><![endif]--> <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <title>Document</title> </head> <body> </body> </html> Fork the Gist While it’s interesting to explore these possibilities, the “classic” method is still generally the most understandable. It doesn’t create invalid HTML, doesn’t risk throwing IE into quirks mode, and you won’t have a problem with the Compatibility View icon if you use a server-side config. If you find any other approaches, or problems with those posted here, please leave a comment but also consider adding what you’ve found to the relevant issues in the HTML5 Boilerplate GitHub repository. Thanks to Paul Irish for feedback and suggestions. Full Article
es Quick tip: git-checkout specific files from another branch By nicolasgallagher.com Published On :: Wed, 12 Oct 2011 17:00:00 -0700 The git-checkout command can be used to update specific files or directories in your working tree with those from another branch, without merging in the whole branch. This can be useful when working with several feature branches or using GitHub Pages to generate a static project site. The git-checkout manual page describes how the git checkout command is not just useful for switching between branches. When <paths> or --patch are given, git checkout does not switch branches. It updates the named paths in the working tree from the index file or from a named <tree-ish> (most often a commit)…The <tree-ish> argument can be used to specify a specific tree-ish (i.e. commit, tag or tree) to update the index for the given paths before updating the working tree. In git, a tree-ish is a way of referring to a particular commit or tree. This can be a partial sha or the branch, remote, and tag name pointers. The syntax for using git checkout to update the working tree with files from a tree-ish is as follows: git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>… Therefore, to update the working tree with files or directories from another branch, you can use the branch name pointer in the git checkout command. git checkout <branch_name> -- <paths> As an example, this is how you could update your gh-pages branch on GitHub (used to generate a static site for your project) to include the latest changes made to a file that is on the master branch. # On branch master git checkout gh-pages git checkout master -- myplugin.js git commit -m "Update myplugin.js from master" The need to update my gh-pages branch with specific files from my master branch was how I first found out about the other uses of the checkout command. It’s worth having a read of the rest of the git-checkout manual page and experimenting with the options. Full Article
es A simple Git deployment strategy for static sites By nicolasgallagher.com Published On :: Wed, 01 Jan 2014 16:00:00 -0800 This is how I am deploying the build of my static website to staging and production domains. It requires basic use of the CLI, Git, and SSH. But once you’re set up, a single command will build and deploy. TL;DR: Push the static build to a remote, bare repository that has a detached working directory (on the same server). A post-receive hook checks out the files in the public directory. Prerequisites A remote web server to host your site. SSH access to your remote server. Git installed on your remote server (check with git --version). Generate an SSH key if you need one. On the server Set up password-less SSH access First, you need to SSH into your server, and provide the password if prompted. ssh user@hostname If there is no ~/.ssh directory in your user’s home directory, create one: mkdir ~/.ssh. Next, you need to copy your public SSH key (see “Generate an SSH key” above) to the server. This allows you to connect via SSH without having to enter a password each time. From your local machine – assuming your public key can be found at ~/.ssh/id_rsa.pub – enter the following command, with the correct user and hostname. It will append your public key to the authorized_keys file on the remote server. ssh user@hostname 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub If you close the connection, and then attempt to establish SSH access, you should no longer be prompted for a password. Create the remote directories You need to have 2 directories for each domain you want to host. One for the Git repository, and one to contain the checked out build. For example, if your domain were example.com and you also wanted a staging environment, you’d create these directories on the server: mkdir ~/example.com ~/example.git mkdir ~/staging.example.com ~/staging.example.git Initialize the bare Git repository Create a bare Git repository on the server. This is where you will push the build assets to, from your local machine. But you don’t want the files served here, which is why it’s a bare repository. cd ~/example.git git init --bare Repeat this step for the staging domain, if you want. Write a post-receive hook A post-receive hook allows you to run commands after the Git repository has received commits. In this case, you can use it to change Git’s working directory from example.git to example.com, and check out a copy of the build into the example.com directory. The location of the working directory can be set on a per-command basis using GIT_WORK_TREE, one of Git’s environment variables, or the --work-tree option. cat > hooks/post-receive #!/bin/sh WEB_DIR=/path/to/example.com # remove any untracked files and directories git --work-tree=${WEB_DIR} clean -fd # force checkout of the latest deploy git --work-tree=${WEB_DIR} checkout --force Make sure the file permissions on the hook are correct. chmod +x hooks/post-receive If you need to exclude some files from being cleaned out by Git (e.g., a .htpasswd file), you can do that using the --exclude option. This requires Git 1.7.3 or above to be installed on your server. git --work-tree=${WEB_DIR} clean -fd --exclude=<pattern> Repeat this step for the staging domain, if you want. On your local machine Now that the server configuration is complete, you want to deploy the build assets (not the source code) for the static site. The build and deploy tasks I’m using a Makefile, but use whatever you feel comfortable with. What follows is the basic workflow I wanted to automate. Build the production version of the static site. make build Initialize a new Git repo in the build directory. I don’t want to try and merge the new build into previous deploys, especially for the staging domain. git init ./build Add the remote to use for the deploy. cd ./build git remote add origin ssh://user@hostname/~/example.git Commit everything in the build repo. cd ./build git add -A git commit -m "Release" Force-replace the remote master branch, creating it if missing. cd ./build git push -f origin +master:refs/heads/master Tag the checked-out commit SHA in the source repo, so I can see which SHA’s were last deployed. git tag -f production Using a Makefile: BUILD_DIR := ./build STAGING_REPO = ssh://user@hostname/~/staging.example.git PROD_REPO = ssh://user@hostname/~/example.git install: npm install # Deploy tasks staging: build git-staging deploy @ git tag -f staging @ echo "Staging deploy complete" prod: build git-prod deploy @ git tag -f production @ echo "Production deploy complete" # Build tasks build: clean # whatever your build step is # Sub-tasks clean: @ rm -rf $(BUILD_DIR) git-prod: @ cd $(BUILD_DIR) && git init && git remote add origin $(PROD_REPO) git-staging: @ cd $(BUILD_DIR) && git init && git remote add origin $(STAGING_REPO) deploy: @ cd $(BUILD_DIR) && git add -A && git commit -m "Release" && git push -f origin +master:refs/heads/master .PHONY: install build clean deploy git-prod git-staging prod staging To deploy to staging: make staging To deploy to production: make prod Using Make, it’s a little bit more hairy than usual to force push to master, because the cd commands take place in a sub-process. You have to make sure subsequent commands are on the same line. For example, the deploy task would force push to your source code’s remote master branch if you failed to join the commands with && or ;! I push my site’s source code to a private repository on BitBucket. One of the nice things about BitBucket is that it gives you the option to prevent deletions or history re-writes of branches. If you have any suggested improvements, let me know on Twitter. Full Article