Skip to content

Instantly share code, notes, and snippets.

View satya164's full-sized avatar
🦋
Trying…

Satyajit Sahoo satya164

🦋
Trying…
View GitHub Profile
"use strict";
function Lace(selector) {
var nodes, el;
// Handle situation where called without "new" keyword
if (false === (this instanceof Lace)) {
return new Lace(selector);
}
@satya164
satya164 / quantity-query.scss
Last active September 7, 2023 20:06
Quantity Queries in Sass
@mixin quantity-query($selector, $type, $amount, $max: null) {
@if $type == at-least {
#{$selector}:nth-last-child(n+#{$amount}),
#{$selector}:nth-last-child(n+#{$amount}) ~ #{$selector} { @content; }
} @else if $type == at-most {
#{$selector}:nth-last-child(-n+#{$amount}):first-child,
#{$selector}:nth-last-child(-n+#{$amount}):first-child ~ #{$selector} { @content; }
} @else if $type == between {
@if type-of($max) != "number" {
@error "Max value must be a number for quantity-query.";
@satya164
satya164 / sbc-api-react.sublime-settings
Last active June 4, 2017 08:22
Sublime Text auto-completions for ReactJS
// Usage:
// Go to `Sublime Text > Browse Packages`
// Place the file under `User` directory
// Enable the `react` in `sb-setting.sublime-settings` (refer <https://github.com/Pleasurazy/Sublime-Better-Completion/>)
{
"scope": "source.js",
"completions":
[
// Usage:
// Go to `Sublime Text > Browse Packages`
// Place the file under `User` directory
{
"scope": "source.js",
"completions":
[
// Top-level API
@satya164
satya164 / sbc-api-react-es5.sublime-settings
Last active September 15, 2016 09:27
Sublime Text auto-completions for ReactJS (ES5)
// Usage:
// Go to `Sublime Text > Browse Packages`
// Place the file under `User` directory
// Enable the `react-es5` in `sb-setting.sublime-settings` (refer <https://github.com/Pleasurazy/Sublime-Better-Completion/>)
{
"scope": "source.js",
"completions":
[
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@satya164
satya164 / react-native-release.sh
Last active December 21, 2015 10:44
Release script for React Native (WIP)
#! /bin/bash
RELEASE="$1"
JAVA_VERSION="1.8"
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[0;34m"
ENDCOLOR="\033[0m"
@satya164
satya164 / class-properties-to-methods.js
Created January 8, 2016 18:17
Codemod to convert class methods to properties, and remove `.bind(this)` in JSX props
// Codemod to convert class methods to properties, and remove `.bind(this)` in JSX props.
// Doesn't support Flow annotations yet
export default function(file, api) {
const j = api.jscodeshift;
const convertToClassProps = p => {
const node = p.node;
if (node.key.name.indexOf('_') === 0) {
node.type = 'ClassProperty';
/* @flow */
/* eslint-disable no-console */
let _types: ?Array<string>,
_filters: ?Array<string | RegExp>,
_history: ?Array<{ timestamp: number; args: Array<any>; }>;
const labels = {
info: '[info]',
warn: '[warn]',
@satya164
satya164 / MainActivity.java
Last active December 2, 2016 20:03
react-native-fbsdk in React Native 0.29.+
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MyApp";
}